<?php
/**
 * Created by PhpStorm.
 * User: zyh
 * Date: 2018/5/9
 * Time: 上午11:09
 */

namespace app\admin\model;

use think\Model;
use think\Session;

class Admin extends Model
{
    public $username;
    public $password;



    public function register($arr)
    {
        $arr['password'] = md5($arr['password']);
        $this->data = $arr;
        return $this->save();

    }

    public function login($arr)
    {
        $user = $this::get(['username'=>$arr['username'],'password'=>md5($arr['password'])]);
        if ($user){
            Session::set('admin_login',true);
            return true;
        }
        return false;
    }

}